package materials;

import hulppakket.Color3f;
import hulppakket.Intersection;
import hulppakket.Scene;

public class CombinedMaterial extends Material {

	private Material material1;
	private Material material2;
	private float weight1;
	private float weight2;

	public CombinedMaterial(String name, Material material1,
			Material material2, float weight1, float weight2) {
		super(name);
		this.material1 = material1;
		this.material2 = material2;
		this.weight1 = weight1;
		this.weight2 = weight2;
	}

	@Override
	public Color3f getShadedColor(Scene scene, Intersection intersection) {
		Color3f color1 = this.material1.getShadedColor(scene, intersection);
		Color3f color2 = this.material2.getShadedColor(scene, intersection);
		color1 = color1.scale(weight1);
		color2 = color2.scale(weight2);
		return color1.add(color2);

	}

}
